gateway: more cleanup