Correction of bugs when changing the pwd