Fix bug when getting attributes of belongsto relationship