Fix and optimize TagTrace.