fix bug when reading .gz file