fixed infinite loop alert bug