Fixed repeat error, which occured when repeat counter is modified within the repeat block