Removed headers_sent check