binom function, and more asserts everywhere