fix a bug with residue encoding TotalFrames parameter