too many redirections bug fix