Replace counter-based logic with initialization flags to properly handle toggle state changes. The previous implementation used counters that would block the first user click from triggering install/uninstall actions.