bug fixes, particularly with random sampler code