fix reference integrity check in metadata