Fix more notices, get query working.