fix circular infinite loop