fixed some bugs with 2d density estimation