fix loop errors1