Fixed bug that occurred when an exception was thrown in user-defined callback methods