Fixed redirect loop pointed out by Frank Olivier at Microsoft.