Fix deactivate bug