Because of Python's funny scoping rules with lambdas, we were always using the value of `macro` as set in the last iteration of the loop. This problem was introduced by e7bdfba4.