use separate function for setting route parameters

This fixes the regression made in #451