added dict size check