Fixed issue with redirect loop