Add safeguard to avoid circular event triggering