Fix small syntax errors in SQL queries.
Add debug panel in app.html.
Fix problem in JSON generator.