Fixes Fatal error of using $this when not in object context
Merge pull request #697 from Andr3as/697

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