fix bug when input file is bad