fixed expression to ensure gates is an array