Update gateway.py