Fix issue with infinite loop in contract rendering