fix infinite loop problem at jvm