Fix primality logic.