Fix DIRECTORY_SEPARATOR and chmod