Fix default values in getPublicFields()

instead move the ``$this->setError()`` above.