Fixing error when using $this