fixed bugs, added example for queries.count