[fix] cs fix and repalced inline chdir call with revertCwd function