fix array bounds problems in readers