Import missing var
Fix some errors in the queries
Fix dbspec config and queries