Further fixes to database queries (bad queries are now noted on startup).
Segfaults on singleShotMode