Fix some issues with "this" in anonymous functions