Fixed scope issue in worker.js