Fix self-deactivation bug