bug fix for flex_residue_min()