this seems to recompute parameter direction correctly