Fix encodePack