fix locking in server