Reduced timeout in tests for lock
made locking robust to very long URIs + improved MacOS patch