Casting same child fails sometimes

yep, it was a silly mistake of not decrementing the length, I guess there is no index out of bounds error with these