fixed a bug that cannot remove query on unload program