Fixed incorrect variable name generation in rules bug