updated poll.js to write files to the correct location