fixed possibly undefined values in the localStorage

Hopefully I didn't get it wrong
Works on my setup (should be tested on the js side)