fix bugs and add test for relation data import