Fix variable nampespace and PHP 5.3 compatibility

$this in Closure is allowed in PHP 5.4 only.