Fixes for bytes encoding/decoding