handle various exceptions
added tests