fix error if localStorage is empty.