gateway: add some asserts on gw_handler