Fixed null-checking in data factory.