Fix compatibility issues with lower PHP versions.

Now supports PHP 5.0.0 and up