Fixes issues related to handling lockfiles before they  exists