Fix priv detection error, and unicode crash