Fix lockfile speed issues

@reset I finally tracked it down. I think this is also going to solve a shitton of other problems.

Somehow this magic was lost in a refactor somewhere...