Fixed query saving, keep dir for generated files