- make debug finalizers depend on DEBUG
- fix event handler declarations.