Fix the repeat entries bug