bug in cookie logic fixed