fallback on cookies if localStorage is null or undefined