added tests for error catching