undefined checking fix