Adding cookie logic-fix