Bug fix in connection