added hasError func to validation