use window.top.location.replace instead of redirect_to