move logic into nill check