When NaN gets displayed it usaly means that you tried to assign a wrong type of value to something.
But i dont see that in de your code. I dont see see anything wrong in storing/getting.
There is one thing more i can suggest. Assign a 'Clear storage" to a key press. Run it. Press the key. Quit it. Try again.
This will heal a corrupt local storage. We all code with try and error. With each version the local storage gets weird. This will also clear a full local storage.
Hope that helps you out.