Fixed weird loop stuff