fix map write stream
fix map write stream
tidy & use createWriteStream to write map