fixed bug AttributeError: None type is not iterable