Introduce helper functions and rewrite bef.getMetadata and bef.getDataset. related to #24 #23 #22 #21
fix a mistake when copying