Fixed problem in repetition direction detection