Fixed last update
added global $priv variable