fixed bug on gate passing