Fix infinite loop in inflate