fixed tex_avg script