fixed bug in stratified sampling