fixed addVar so that it creates the first scope when coming into empty scope