Added more logging information for errors