fix the repetition bug