Fix the bug when reading data from file.