Threads synchronization fixed