fix MNIST sampling bug