Error in primality checker