improving batch in sampling