Only emit a new cookie when necessary, avoid duplicates.
Remove debug codee.