better handling of metadata