use exit to catch main error