update encode methods to be in line with CF11 implementations