Fix code which deals with executing queued continuations
Add error checking to auto_reset_event