fixed a bug that occurred when there was more than one-to-many on same level