Fixed repeat handling. Thx to Bleifuss for the patch.