Properly register a deactivation hook