Avoid useless database write when syncing