Catch exception in redirect as pointed out by mgorny at PR #41