apply patch from @Ryanl92 fixing #1700