Resolved a bug with wrong order of calls in an exception case