minor changes to ScanTS.R