fix and simplify findAndSaveImports