Fix many problems with import from files