Traceback (most recent call last):
  File "/home/marco/.qgis2/python/plugins/svir/svir.py", line 348, in normalize_attribute
    layer = reg.mapLayers().values()[
UnboundLocalError: local variable 'reg' referenced before assignment

This needs to go out of the if