redesign exchange_insert dialog and fix log print (flush output)