handle str::from_utf8() failure, improve return calls