fixed bug with gate type