fix metadata retrieval containing empty values

Sometimes metadata can be set, but its value can be empty (for example
when a property is removed).