Fix loading query into UI and stuff