encoder: fix capacity increasement
nbt: port to encoder API