petea - modified changecookie function