fixed bug in primitive_root