Handle synchronous exceptions better

Same as #83 but with a fixed diff