Fix for Ruby1.9+ where strings are no longer bytes but characters
Fix error thrown when exiting before connection is made