fixed 'header already sent'