Fixed error in repetition handling