Lockfile fixes

Fixes for #532 and #529 (including features for regression)