Fixed main method exception handling.