Issue #3320240 by solideogloria, tobiasb, smustgrave, alexpott: Entity count query returns a string instead of int (cherry picked from commit c1891492)