Backport lockfile fixes