added exception handling
tests for exceptions