Fixed unnecessary reassignment of is_valid_str