Fixed the DeleteEvent function