modify to support PHP 5.4