fixed three units and one logic defect in histogram-fill-with-water problem