Fix delete

This reduces QueryAndDelete runtime by 25% on my machine.