added null check to errFields