fix wrong setting of LAN designator
simplify and drop global variables
Merge remote-tracking branch 'tlf/master'