add more tests for error cases