fix cookie bugs