fix the while true bug