bugfix in function which selects unfolding routine