Bug fix for #529

As I mentioned in #529, this pull request simply backport a patch (4431729220d45889144e29943d76d74badea7e9a)  to raven 2.x. branch. 

Today I noticed that the 2.0.x branch has been created, so I create this pr.