Fix error with rigLayer exceeding loop condition