fix bug in query remove