Debug removal and gate fixes