fixes some cases when testing imports from wrong locations, #904, #908