Fixed type issues, fixed a couple of syntax errors in popup.js