Added better exception checking on startup.