Merge pull request #104 from Rathil/master

Fix for method count without specifying $criteria but with the condition in defaultScope
merge with base/master
Rewrite old fix #2