Try making mktemp always return bytes.