better gate initialization