Working out synchronization bug