handle exceptions, close #6 #2