updated deadlock to test if lock file exists