checks for NPE