fixed the to_string() function to return a string instead of char*