Fix lockfile speed issues (2-0-stable)

@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...