Visual editor: leaking scope fix