small corrections to apply sampling