Fixes for PHP 5.4
Merge pull request #3 from ceeram/php54

Fixes for PHP 5.4