better handling of alerts popup