Fixed a bug which caused that the repeat mode was always used