Metadata test added and bug fix.