fix bug in extracting redirect