internal levels dict must be reinitialized every time deptree object is actually modified. At the same time, when making room on a certain deptree key (moving the entries to another key), make sure to always drop the dep item that is going to be written back. "equo install --empty --pretend lighttpd" triggered the issue. Thanks to micia for reporting.