fix some relationship related bugs