Reimplement fix for #233 on the develop branch.