Gradient correction for polygonal and polyhedral finite elements