avoid fail if localStorage is undefined