Fixed bug in RAM sampler