Added ktrace mode handling