refactorings in lock file handling