Fixing gcc problem with EncodeToBuf-function.