Fixed some issues with localStorage