move getmetadata() call to common.js