correcting pointer allocation