Fix how relationships array is built