added check against writing nan/inf for number data types