MNT: Fixed bugs in query_widget