Fixed current working directory logic.