Fixed some problems with PHP 5.4