Fixed bug where cookie didn't get destroy in certain circumstances