Fix bug in environment gathering on the master
Prevent double environments fomr unconfigured interfaces
Fix environment tracking issues and add write lock system