Handle metadata key deletions (fixes #296)

hi, this is a patch for bug #296
hopefully it causes no regressions

best regards,

bl0ckeduser