Fixed utf8 conversion bug - no null-terminating character
MCS_pathtoref_and_leaf: condition corrected