Fixed indices error causing strange bugs...