Fixed bug with lock file checking