sync with latest cowboy, bug fixes
Merge pull request #3 from eryx67/master

sync with latest cowboy, bug fixes