fix dirname and wc due from_utf8 changes and resolve warnings