change localStorage to cookie