Fix boundary condition bug in histogram

Fixes #5.