replaced mutex with lockfile to work better cross platform