added proper logging of errors in data files