Add check for NPE