Added exception logging