Added patch from John Hay. Due to diff from last release to HEAD this had to be done...