Bug correction on reading and byte counting