added more logging on errors