Fixed gateway update logic