fixed some errors in the findHomeRelation function