fixing bug in totalCount result