More debug errors and PHP 5.4+ fixes