Fix bugs in TT scanner