fixed settings bug in run_query