fixing setting cookie bug