added printErrors method