fix for MB-12689: remove nil values after all key/values are fetched