fixed bug in read call