Fix key error with gateway, fixes #9841
Merge pull request #9842 from techhat/gateway

Fix key error with gateway, fixes #9841