Allow the gateway to be null. Closes #1240.