Fixed a bug when using multiple couchbase clients.

Changed the way the connection event is handled/fired.
Other minor fixes.