Attempt to make the code PHP 5.2 compatible