Fix directory tracking in the shells.