Fix remove so it works with queries.