Fix alert related bugs