tweak replaceSingleVar