Fixed bug in quadratic sieve