add debugging hooks