Misc fixes for cookie setting