added flatten to dict