bugfix: make set_d work as well for q_expansion