cleanup in IMagicTemplate