buffer and memcpy adjustments