adding missing exception handling.