delayed deletion in new locking scheme
and lots of bugfixes along the way