Handle cookies correctly