Improve side effect handling during refinement.