Fix gateway part of #263