Fixed the request counter that avoids the redirect loops.