fix array bounds problem in byte array reader