fix database manipulations to update metadata