fix illegal nesting error