support both list and dict