found a bug in histogram function, fixed it