replace bool with errorFlag #22