fix query/wait being emitted twice