Bug: Query primes with a pattern weren't cleared on delete of primes