Fix wrong assignment of scope variables.