Don't set cookie if headers have been sent.