fix query for selecting count of users (BAC-303)