fixing possible NPEs