use state flag, not type.