Fixing some bugs in the reader