use writeFileSync instead of writeFile