This fixes #8188.  It was not correctly inserting the gateways automatically.  Now it does insert them correctly.