Fixing ph plotting problems