fixing bugs in tS