add NoneType check.