fixing prime_factors method