Some bug fixes with synchronization