Fix javascript errors

The app now works. Kinda.