NPE fix on null check