Fix bug where referencing $this instead of $app