fixed exceptions and formating