Fix stack overflow in IE