fixed a bug in the ExtractSamplesAt