Working on locking system (synchronization issue)