bugfix: ensuring connection in transactions and string escaping