fix porosity calculation issues