add try catch to localStorage assigning