Code improvements, and bug fixes in connectors