fix infinite loop in gear creation