corrected Sieve function