add more error checking, optimize
Merge branch 'master' of https://github.com/Blizzo/IRCbot