adding logging for errors