Fix authenticity token error with caching
Fix bug when there are no repetitions