Fix possible bug in `flattenContent'