window.localStorage can cause exception based on browser settings. Fixes #36.