added logging for exceptions