fix cookie generation