patch from #745; thanks Tristan