avoid getwcd() error by switching directory