Fixed possible NPEs