count query fix