Made slight change to deal with Unicode encoding exception