fix computation of pH, fix assertions