added source element check to ensure only adding valid sourceElement attributes