Apply patch from @ksuess