Update gateway.cc