Fix some internal defects.