fixed memory leak
script work and tvecselect add from Rakib