more robust handling of nils