fix major relationship bug, add more tests