Fixed seg fault occuring in t_terminate