improve localStorage again; falls back to session cache if localStorage fails for any reason