I hope this is not my fault? I actually didn't change the ranges...

range(max_bin + 1) or range(1, max_bin + 1)?