main query tests including write back working