Metadata upgrade and bug fix