fix handling of unicode during decode