fixes util.js to pass unit tests

Two small fixes to util.js to make sure all unit tests can pass

1. Function named to `discreteBranchFn` to deal with an 'already defined' issue
2. `console.debug` was throwing an error so changed to `console.log`. Does this depend on the context you test it within? Is there any reason it should definitely be `console.debug` instead?