Fixed checing countOfErrors