properly handle metadata values that contain spaces