Fixing code for PHP 5.4