minor changes to subsample code