use Open3.capture2 instead of .capture2e. Error messages are written to stdout
update .exec to properly escape arguments to Open3.capture2
add UTF-8 encoding fix for invalid byte sequences.
add nil check for metadata return values