fixed bugs in repeat