use the built-in cookies functions instead of writing the header directly