Added check for invalid file.
Added check for invalid file.