logout before output to not run into header already sent problems