apply hvr's patch

fixes clang 3.1 segfault