handle exceptions, close #6