Fixed some NPEs.