solve problem of not storing in cookie