fix a bug during refinement.