Fix for 'NoneType' object

TypeError: 'NoneType' object is not iterable