[BUG #1966] alternate variableoptimizer, based on new scopes