add equi-depth histogram, more unit tests, fix potential bugs