fix a bug in set cookie