add hook to dispose resources