prepare for query cleanup code