Fixed bug while merging scans. Used indexSD instead of indexS