Use TMxpElement as a value class to avoid memory leaks.
Fix memory leak in Host.