Bug fixes for pH calculation.