fix infinite loop in test