Fixed addVariable to work with new grouping method.

Fixed addVariable to work with new grouping method.