fix test cases for error handling.