bug fixed with synchronization