fixed a major decode bug in residue 1