Fixed a bug in the gateway registration