fix non-contiguous custom fields over-write problem, also remove non-required template