Correction of loop to remove test