Fix prime generator