fix cookie code