added 'if' to saving config