Fixes for the __residue_loop() method.
The selection object is now used for comparison.
Authored by: bugman 2008-04-20
Parent: [r5876]
Child: [r5878]