fixes problems with dottie and raw queries

See #2061