Ensure content-type is set before echoing