fix NPEs when it happens to transform null bytes