Handle exceptions a bit more gracefully