Fixed some byte-error bugs