Minor cleanup, improved lock file detection