add packFromBuffers function