fix error "header already sent"