fixed example code to use to_string() instead of to_str()