fix 'undefined method  for file' error