Adding new Legend terms

Fixed a bug causing Legend config button to be essentially pressed twice
Better error prevention and checking when adding new Legend terms