make metadata action more robust