isPrime method fixed.