fixing localStorage reading bug