fix bug: stackoverflow error when has circular relation