fixed the ordering in cdl encoder