handle data nulls and type errors