fixed bug that metadata was not saved to disk