minor fixes to locking and send