Catch exceptions thrown from main, fix #48