Remove more c casts.
Add a query destructor.
Change the return type of `expr`.