Fix broken redirect on error