Fix bug with synchronization