fix endless loop when checking rights, update #1538