Fixed AttributeError: 'NoneType' object has no attribute 'decode'