Improved leave event auto-creation logic.