Switched from using to_string() method to using stringstreams (because of issues on Sharcnet). Also changed some ints to uints