Fixed non-existent buffer error.
Change to code to try and avoid a static call in a function using $this.