Exception handling works but it is done in the wrong place. Related to #22