Fix the UCBmax calculation and add debugging options