Fix #171: rework query clone to avoid spurious copy of dataset

Fixes #171.
The `copy` import can be removed now.