update gate logic