Fixes boto/boto#2524  based on comment from averigin