Another fix related to NoneType iterration