Cleanup of casting in TermModifier.