Fixed bug of not switching to the working directory