Catch some errors and exit