extra ETERM creation removed, memory leak and performance improvement