Fix PHP 5.4 bugs. Fixes #108