Cast query to string

Query can also be Query Expression, so cast to string. Fixes #129