Option flags in upgrade should be unique
Merge branch 'jm/unique_flags' PR #640