corrected some NPEs