closes #9071 (closed)
but also closes #9066 (closed)
and fixes a NullpointerException in GatewaysManager.