Fix for 'NoneType' is not iterable