Handle NoneType correctly.