error checking for local storage