Better error handling in callback mode (#5)