improved invalid file errors