Update code to fix PHP 5.3 errors