fixed undefined edge case for localstorage parsing