fix bug AttributeError: 'function' object has no attribute 'put'