added typecheck for metadata setter function