fix the io problem for files end with emepty line.