Fixing localStorage bug