changed the condition to use the common lock