Fix patch to remove related items from database