Fix incorrect encoding of value buffer.

Fix transposed a ternary conditional.

See #22.