Fixed settin working directory when niche changes.