typo
Fix some null/undefined checking