Updated code to ensure backwards compatibility with PHP 5.3.x.