Small fixes for density estimation