add nullcheck - input files without a dataset gave a nullpointer error.