Fixed PHP errors when using PHP 5.4