fixes to client indexes and their handling, also count queries are now properly incremented/decremented only when they should