updated and made sure average zdensity is working properly