Fix enginesync tests now that sync state change is a queued event.
Also fix code that tests revealed was broken!