fixed a few bugs related to the relation change