Fix bug with getErrorMessage()