Fix bug encoded \0 bytes