}
        }
 
-       dict<int, Wire*> mergeability_to_clock;
        for (uint32_t i = 0; i < flopNum; i++) {
                RTLIL::Wire *d = outputs[outputs.size() - flopNum + i];
                log_assert(d);
                        }
                        else if (type == "box") {
                                RTLIL::Cell* cell = module->cell(stringf("$box%d", variable));
-                               if (cell) // ABC could have optimised this box away
+                               if (!cell)
+                                       log_debug("Box %d (%s) no longer exists.\n", variable, log_id(escaped_s));
+                               else
                                        module->rename(cell, escaped_s);
                        }
                        else
                auto name = wp.first;
                int min = wp.second.first;
                int max = wp.second.second;
+               if (min == 0 && max == 0)
+                       continue;
 
                RTLIL::Wire *wire = module->wire(name);
                if (wire)