handle exceptions a little smarter