fix bug: $this when not in plugin context