Fix for PHP 5.3 where you can't use '$this' in a callback.