Fixed a bug where some records where written even when the sync was off