fixed prime generation and tests