fix bug with wrong document being unsubscribed in certain queries