fixed potential issue with exit event