updated encoding checks for bytes/string, fixes pipe problem