fixed bug in data reading