Bug fixes and adjustments

Fixed a bug in the optimized version of the sieve generation. Also did
some other smaller tweaks.