Added changes for PHP 5.2 and below