fixes to ts detection