apps.js: fix scoping issues preventing the app from working in strict mode