remove second call to getpid in lock()