fix redirect when not ajax