Make sure we are inside a run loop before syncing

See #2838