Fix bug in reverseBufferAndInsertHeader: need to use the passed-in type, not hard-coded UDATA.