changed errorhandler implementation because it needs PHP 5.5