query_counts BASEDIR bug