Make endomorphism optimization optional