Fix CR by pmwkaa. part 3
1) Add checks and tc_errors
2) Allocate memory in tc_buf.