added tests for error cases