fixed check for cookies with hasOwnProperty