Fix syntax and localStorage usage