fix AlertType warning; simplize code