add try catch for the input file