Fixed AttributeError: 'dict' object has no attribute 'name' error