fix double redirect on failed api call