Fix bug in lib/spreadsheet/spreadsheet.js caused by uninitialized variable.
Various bug fixes for query loading.