corrected logic flaw in repitition rule