fixed old Gate code, added gate-counter

yes