fix header already sent bug in ErrorController in cli