optimize read dict code