hasRepeat function fixed