Fixed a minor bug with the construction of an error message and replaced if by an elif. Would fail for `mode="pp"`