wrapping main in a try catch