fix potential infinite loop​