Reading correctly from ByteBuffer