added contingency for when missing=nan