Removing the redirect loop