add lock to method put