simplify sync function for latest Otto and fix for sync_gateway#31