persistent settings fix (variable scope bug).