deal with multiple redirections