dump_nm now returns string instead of printing the result