Density computation (minor fixes)