[#1675] Fix for exponential execution time problem in Controller.redirect() + test