changed the handling for alerts