Replaced to_string with own fnct; small bug fixes