Backport bugfix for #17