Bugfix - COUNT database query result was casted to a wrong type.