better cleanup method from debug hack