improved basepath correction