fix mistake on acquiring lock