added error checking for input file