Fix small lockfile regression (#404) and add test