Fix redirect on error