fixed TCO and little valgrind issue about initialization