Removes stack overflow in transpose.