added detector on/off to gate