some functions are modified for cookies.