gateway: make smart gateway threshold parameter work properly.