Fix some issues with sync