fixed condition for metadata deletion