making diagrams work with autocomplete selection