Fix bug in nextVal for flip and multinomial