Fix fatal error thrown while trying to throw an exception

Fixes issue #2