Ported name setting and fixed various bugs.