improved export events function