fixed bug in read