Fix exception handling to stop it from shitting a brick.