fixed more loop protection