corrected various palloc usages