Fixes Fatal error of using $this when not in object context