Fixed histogram equalization bugs.