Merge pull request #264 from hunner/fix_hang