Bunch of fixes in memory management of postprocess binary