Move setDirectory block in order to run properly on Windows