fixed a number of bugs in Reader.