changing get_poly_dim function