fixed the test for increasing the residue number