Fixing several NPE