more reliable way to create cookie, which in some edge cases could not be retrieved