batch sampling modifications
fixed merge conflict