Fixed broken query result on SQLite, closes #706