incorporate fix from sjackman to prevent segfaults
add support for multiple regions from pull request #5
Merge remote-tracking branch: upstream/master