fix error if metadata enabled and there is no metadata