fix and tests for #469
Merge branch 'wrong_count'
Merge pull request #470 from giastfader/master

fix and tests for #469 (wrong count(*) with permissions)