Added more logging of errors