Fixed bug in reading