Improved exception handling, issue #9 (does not solve)