fixed header already sent bug