fixed test cases; added log statements and a necessary exception handler;