Bugs fixed in couchbeard-plugin for connection and some optimizations