decorateModal checks if modal is defined before decorating