bugfix and moving funct to Eco.pm