Fix bugs in importing data