Convert count() result to integer

Type hint is set to `integer` but in fact it returns a string.
When a controller is exposed as REST service, I have to force converting each result of `count()` to integer, because client-side javascript is very picky about types of parameters.