fixed pickling by breaking out metadata object