Fix code to work with PHP 5.3
Merge pull request #1118 from stloyd/bugfix/php_53

Fix code to work with PHP 5.3