Had that before, but then I need to add another level of type detection when closing/flushing.