correctThin function

Checks if thin is consistent with nTotalSamples samples and if not corrects it.