Fixing index triggering bug