Fixed problem on deletion with locks