Add few NPE checks