Added tests for error cases