fixed alert logic