change all comparisons to None to .isDefined