handle dying gracefully