Fixed webpage redirect loop bug