don't unlock inside the loop