Fixed bug in get_relation_name