Fixed issues with PHP 5.2