Finally fixed the densities bug. Misnamed javascript variables