don't use $this inside closures (fixes #32)