style fixes, null checks replaced with undefined