Fix segmentation fault

check if tf_sub_ is not empty and avoid segmentation fault